export function export2xls(data:string,name?:string):void{
    const uri = 'data:application/vnd.ms-excel;charset=utf-8,\ufeff'+encodeURIComponent(data);
    exportFn(uri,`${name||Date.now()}.xls`)
}
export function export2csv(data:string,name?:string):void{
    const uri = 'data:text/csv;charset=utf-8,\ufeff'+encodeURIComponent(data);
    exportFn(uri,`${name||Date.now()}.csv`)
}
function exportFn(data:string,name:string):void{
    const link = document.createElement('a')
    link.href = data
    link.download = name
    link.style.cssText="position:absolute;width:0;height:0;visibility:hidden;padding:0;margin:0" 
    document.body.appendChild(link)
    link.click()
    document.body.removeChild(link)
}